;
(function () {
  // gameBox.style.display="none";
  window.__startGame = function (callback) {

    var winWidth = window.innerWidth * 2;
    var winHeight = window.innerHeight * 2;
    // 创建游戏实例
    window.game = new Phaser.Game(winWidth,
      winHeight,
      Phaser.AUTO, 'game');
    let Preload = require("../modules/lantern/preload");
    let Start = require("../modules/lantern/start");
    let Ready = require("../modules/lantern/ready");
    let Playing = require("../modules/lantern/playing");
    let Success = require("../modules/lantern/success");
    let Fails = require("../modules/lantern/fails");
    // let DicePlay=require("../modules/dicePlay");
    // let Over=require("../modules/over");
    let routers = {
      Preload: Preload,
      Start,
      Ready,
      Playing,
      Success,
      Fails,
    }
    Object.keys(routers).forEach(v => {
      let obj = new routers[v]();
      game.state.add(v, routers[v]);
    })
    game.state.start('Preload');
    if (callback) {
      window.__gameFinished = callback;
    }
  }
  window.__gameFinished = function () {

  }
  // window.__startGame(v=>{
  //   console.log("game callback");
  // });


})();